{  Statement: http://acmp.ru/?main=task&id_task=296
   Verdict: Accepted
}
uses
    SysUtils, Math;

const
    INF : longint = maxlongint;

var
    i,n,x,y,cur:longint;
    a:array[0..1010] of int64;

begin
reset(input, 'input.txt');
rewrite(output, 'output.txt');
read(n);
for i := 1 to n do
    a[i] := INF;
a[3] := 1;
a[5] := 1;
for i:=6 to n do
    a[i] := min(a[i - 3], a[i - 5]) + 1;
x := 0;
y := 0;
cur := n;
while a[cur] > 0 do
    if a[cur - 3] = a[cur] - 1 then begin
        dec(cur, 3);
        inc(y);
    end else begin
        dec(cur, 5);
        inc(x);
    end;
write(x,' ',y);
end.